package com.touchwisdom.fetch.core.model;

import com.jfinal.autotable.AutoTable;
import com.touchwisdom.fetch.core.model.base.BaseFetchConfig;

@SuppressWarnings("serial")
@AutoTable(id = "id", name = "T_Fetch_Config")
public class TFetchConfig extends BaseFetchConfig<TFetchConfig> {
	/**
	 * 所有的 dao 对象也放在 Service 中
	 */
	public static final TFetchConfig dao = new TFetchConfig().dao();

	/**
	 * 获取默认的配置对象
	 * 
	 * @return
	 */
	public TFetchConfig getRootConfig() {
		return this.findFirst("select * from T_Fetch_Config where taskId is null");
	}

	/**
	 * 获取任务对应的配置信息
	 * 
	 * @param taskId
	 * @return
	 */
	public TFetchConfig findByTaskId(String taskId) {
		return this.findFirst("select * from T_Fetch_Config  where taskId=?", taskId);
	}
}